import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'
import path from 'path'

// https://vite.dev/config/
export default defineConfig({
  plugins: [vue()],
  resolve: {
    alias: {  // 这里就是需要配置resolve里的别名
      "@": path.join(__dirname, "./src"),
    },
  },
  server: {
    open: false,
    host: '0.0.0.0',
    port: 3001,
    proxy: {
      '/api': {
        target: `http://127.0.0.1:8888`,
        changeOrigin: true,
        timeout: 5000,
        rewrite: (path) => path.replace(/^\/api/, ''),
      },
    },
  }
})